<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:ui="http://java.sun.com/jsf/facelets" 
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:body>
    	<ui:composition template="./templates/framework.xhtml">
			<ui:define name="content">
				<ui:include src="./templates/header.xhtml">
					<ui:param name="text" value="#{i18n['generic.back']}" />
					<ui:param name="link" value="index.xhtml" />
				</ui:include>
				<h:form id="renameKeeBookForm" styleClass="primary">
					<ui:fragment rendered="#{sessionBean.getKeeBookAccess('OWNER')}">
						<div>
							<h:outputLabel for="keeBookName" value="#{i18n['createBook.title']}" />
							<h:inputText id="keeBookName" autocomplete="off" required="true" requiredMessage="#{i18n['generic.valueRequired']}" value="#{renameKeeBookBean.keeBookName}" />
							<span class="error"><h:message for="keeBookName" /></span>
						</div>
					</ui:fragment>
					<ui:fragment rendered="#{sessionBean.getKeeBookAccess('OWNER')}">
						<div>
							<h:outputLabel value="#{i18n['generic.password']}" />
							<input type="button" value="#{i18n['rename.changePassword']}" onclick="location.href='changepassphrase.xhtml'" class="fullWidthField" />
						</div>
					</ui:fragment>
					<div>
						<h:outputLabel value="#{i18n['rename.delete']}" />
						<ui:fragment rendered="#{sessionBean.getKeeBookAccess('OWNER')}">
							<input type="button" value="#{i18n['rename.deleteBook']}" onclick="deleteKeeBook()" class="fullWidthField" />
						</ui:fragment>
						<ui:fragment rendered="#{not sessionBean.getKeeBookAccess('OWNER')}">
							<input type="button" value="#{i18n['rename.unsubscribe']}" onclick="unsubscribeKeeBook()" class="fullWidthField" />
						</ui:fragment>
					</div>
					<ui:fragment rendered="#{sessionBean.getKeeBookAccess('OWNER')}">
						<div class="buttons">
							<h:commandButton type="submit" value="#{i18n['generic.save']}" action="#{renameKeeBookBean.rename}" />
							<input type="button" value="#{i18n['generic.cancel']}" onclick="location.href='index.xhtml'" />
						</div>
					</ui:fragment>
				</h:form>
			</ui:define>
		</ui:composition>
    </h:body>
</html>